package com.black.utils.file.compress.jar.visitor;

import com.black.utils.file.compress.jar.entity.AnnotationFieldInfo;
import com.black.utils.file.compress.jar.entity.AnnotationInfo;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;

/**
 * @author ylx
 */
public class JarAnnotationVisitor extends AnnotationVisitor implements Opcodes {

    private final AnnotationInfo annotationInfo;

    public JarAnnotationVisitor(AnnotationInfo annotationInfo) {
        super(ASM7);
        this.annotationInfo = annotationInfo;
    }

    @Override
    public void visit(String name, Object value) {
        AnnotationFieldInfo annotationFieldInfo = new AnnotationFieldInfo(name, value);
        annotationInfo.addAnnotationField(name, annotationFieldInfo);
    }
}
